if CLIENT then

/* Client DataStream object */
DS = {}

/* Receive team information */
DS.GetTeamInfo = function( hdl, id, encoded, decoded )

	/* Debug output */
	DEBUG:Msg( "Team information received: " .. tostring( decoded.ChatName ), "DS.GetTeamInfo" )
	
	/* Get the team on client */
	local tm	= team.GetInfo( decoded.ID )
	if not tm then
		team.SetUp( decoded.ID, decoded.Name, decoded.Color )
		tm		= team.GetInfo( decoded.ID )
	end
	
	/* Update the team on client */
	tm.Name				= decoded.Name
	tm.Color			= decoded.Color
	tm.MaxPercent		= decoded.MaxPercent
	tm.ChatName			= decoded.ChatName
	tm.CreateTime		= decoded.CreateTime
	tm.DefaultLoadout	= decoded.DefaultLoadout
	
	/* Debug output */
	DEBUG:Msg( "Team " .. tostring( decoded.ChatName ) .. " updated", "DS.GetTeamInfo" )
end

/* Add the hook */
datastream.Hook( "DS.GetTeamInfo", DS.GetTeamInfo )

end